package switchviz.gui.component;

import java.awt.event.ActionListener;

import javax.swing.JMenuItem;
import javax.swing.JPopupMenu;


public class PopupMenu extends JPopupMenu
{
	/**
	 * 
	 */
	private static final long serialVersionUID = 655245327302833791L;

	public PopupMenu(String[] menuarray, ActionListener l)
	{
		for(String menu : menuarray)
			addCustomMenu(menu, l);
	}
	
	
	private void addCustomMenu(String command, ActionListener l)
	{
		JMenuItem menuItem;
        menuItem = new JMenuItem(command);
        menuItem.setActionCommand(command);
        menuItem.addActionListener(l);
        this.add(menuItem);
	}
	
}
